package com.issue.common.utils.excel;

import com.issue.common.core.domain.R;

/**
 * @Author: xuxiang
 * @Description:
 * @Date: Create in 2018/10/14 22:27
 */
public class ResponseMsgUtil {

    public static ResponseMsg success(Object object) {
        ResponseMsg responseMsg = new ResponseMsg();
        responseMsg.setData(object);
        responseMsg.setCode(R.SUCCESS);
        responseMsg.setMsg("操作成功");
        return responseMsg;
    }

    public static ResponseMsg successPage(Object object,String totalCount) {
        ResponseMsg responseMsg = new ResponseMsg();
        responseMsg.setData(object);
        responseMsg.setCode(R.SUCCESS);
        responseMsg.setMsg(totalCount);
        return responseMsg;
    }

    public static ResponseMsg success(String msg) {
        ResponseMsg responseMsg = new ResponseMsg();
        responseMsg.setCode(R.SUCCESS);
        responseMsg.setMsg(msg);
        return responseMsg;
    }
    public static ResponseMsg success(Object object,String msg) {
        ResponseMsg responseMsg = new ResponseMsg();
        responseMsg.setData(object);
        responseMsg.setCode(R.SUCCESS);
        responseMsg.setMsg(msg);
        return responseMsg;
    }

    public static ResponseMsg success() {
        return success(null);
    }

    public static ResponseMsg error(int code, String msg) {
        ResponseMsg responseMsg = new ResponseMsg();
        responseMsg.setCode(code);
        responseMsg.setMsg(msg);
        return responseMsg;
    }

    public static ResponseMsg error(SysReturnCode sysReturnCode) {
        ResponseMsg responseMsg = new ResponseMsg();
        responseMsg.setCode(sysReturnCode.getCode());
        responseMsg.setMsg(sysReturnCode.getMsg());
        return responseMsg;
    }

    public static ResponseMsg error(String msg) {
        ResponseMsg responseMsg = new ResponseMsg();
        responseMsg.setCode(10002);
        responseMsg.setMsg(msg);
        return responseMsg;
    }

    public static ResponseMsg error(Object object,SysReturnCode sysReturnCode) {
        ResponseMsg responseMsg = new ResponseMsg();
        responseMsg.setData(object);
        responseMsg.setCode(sysReturnCode.getCode());
        responseMsg.setMsg(sysReturnCode.getMsg());
        return responseMsg;
    }

}
